package com.ruoyi.project.check.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.check.domain.CheckMode;
import com.ruoyi.project.check.service.ICheckModeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@RequestMapping("/check/search")
public class CheckSearchController extends BaseController {
    @Autowired
    private ICheckModeService checkModeService;
    /**
     * 根据检查结果查询
     */
    @PreAuthorize("@ss.hasPermi('check:search:index')")
    @PostMapping("list")
    public TableDataInfo list( String checkCode)
    {
        List<CheckMode> list = checkModeService.selCheckAllResultSrvice(checkCode);
        return getDataTable(list);
    }

    /**
     * 根据检查单号回显图片信息
     */
    @PreAuthorize("@ss.hasPermi('check:search:index')")
    @GetMapping("/{checkCode}")
    public AjaxResult queryByFile(@PathVariable String checkCode) {
       return AjaxResult.success(checkModeService.selByCodeFileService(checkCode));
    }
}